<!DOCTYPE html>
<html>
<head>
	<title>pctx.html</title>
	<meta charset="utf-8"/>
	<script src="./bower_components/react/react.js"></script>
	<script src="./bower_components/react/react-dom.js"></script>
	<script src="./bower_components/babel/browser.js"></script>

	<style>
		

	</style>
</head>
<body>
	<div id='app'></div>

	<script type="text/javascript">
		function myfn(res) {
			console.log(res)
		}
	</script>

	<script type="text/babel">

		class Search extends React.Component {
			constructor() {
				super();
			}

			render() {
				return (
					<div>
						<input type="text" onChange={this.change.bind(this)} /> 
					</div>
				)
			}

			change(e) {
				console.log(e.target.value)
				let os = document.createElement('script');
				os.src = 'https://www.baidu.com/sugrec?pre=1&p=3&ie=utf-8&json=1&prod=pc&from=pc_web&sugsid=1461,32124,21091,32140,31660,32045,31709,31846&wd=' + e.target.value + '&req=2&bs=ai&pbs=ai&csor=2&pwd=a&cb=myfn';
				document.head.appendChild(os);
			}
		}

		ReactDOM.render(<Search />, app);
	</script>

</body>
</html> 